package controllers;

import java.util.Date;

import models.Event;
import play.cache.Cache;
import play.mvc.Controller;

public class CacheTest extends Controller {

	public static String index() {
		
		String key = "eventInTheCache";
		
		// putting an event in the Cache
		Event event = new Event();
		event.name = "a social event";
		event.begin = new Date();
		event.end = new Date();
		Cache.set(key, event);
		
		// ...
		
		// retrieving the event from the cache
		Event eventFromCache = Cache.get(key, Event.class);
		
		return eventFromCache.name;		
	}
}
